import { EDITOR_ELEMENT_TYPE, PLUGINS_KEYS, Plugin } from '../types';

function Strikethrough(): Plugin {
  return {
    key: PLUGINS_KEYS.STRIKETHROUGH,
    type: EDITOR_ELEMENT_TYPE.INLINE,
    matchLeaf: (props) => !!props.leaf[PLUGINS_KEYS.STRIKETHROUGH],
    renderLeaf: (context) => <del>{context.children}</del>,
  };
}

export default Strikethrough;
